<?php

namespace app\factory\controller;

use app\common\respond\HttpApi;
use app\factory\logic\AbnormalLogic;

class AbnormalController
{
    /**
     * @Description 新增/编辑
     * @author: zj
     * @param HttpApi $respond
     * @time 2024/03/12 14:38:57
     * @return \think\response\Json
     */
    public function addEdit(HttpApi $respond)
    {
        $param = [
            'Id' => request()->post('Id'),
            'BarnId' => request()->post('BarnId'),
            'FenceId' => request()->post('FenceId'),
            'ErrorText' => request()->post('ErrorText'),
            'CaseId' => request()->post('CaseId'),
            'CaseType' => request()->post('CaseType'),
            'SecCaseType' => request()->post('SecCaseType'),
            'Status' => request()->post('Status'),
            'Solution' => request()->post('Solution'),
            'RecordTime' => request()->post('RecordTime')
        ];
        $rule = [
            'Id' => 'require|integer|>:0',
            'RecordTime' => '>:0'
        ];
        validate($rule)->check($param);

        $logic = new AbnormalLogic();
        $data = $logic->addEdit($param['Id'],$param);

        return $respond->success([]);
    }

}